package com.blue.integration.serve.aliyun;

import com.blue.core.util.DateUtil;
import com.blue.integration.serve.IdentityCard;

public class AliyunIdCard
{
	private static final String DATE_FORMET = "yyyyMMdd";
	
	/* 正面信息 */
	private String num; // 身份证号
	private String name; // 姓名
	private String sex; // 性别
	private String birth; // 生日
	private String nationality; // 民族
	private String address; // 地址

	/* 反面 */
	private String issue; // 签发机关
	private String start_date; // 有效期起始时间
	private String end_date; // 有效期结束时间

	private boolean success;

	public AliyunIdCard()
	{
	}
	
	public IdentityCard toIdentityCard()
	{
		IdentityCard card = new IdentityCard();
		card.setNum(num);
		card.setName(name);
		card.setSex(sex);
		card.setNationality(nationality);
		card.setAddress(address);
		card.setIssue(issue);
		
		if (birth != null && !birth.isEmpty())
			card.setBirthday(DateUtil.parse(birth, DATE_FORMET));
		
		if (start_date != null && !start_date.isEmpty())
			card.setStartDate(DateUtil.parse(start_date, DATE_FORMET));
		
		if (end_date != null && !end_date.isEmpty())
			card.setEndDate(DateUtil.parse(end_date, DATE_FORMET));
		
		return card;
	}

	public String getNum()
	{
		return num;
	}

	public void setNum(String num)
	{
		this.num = num;
	}

	public String getName()
	{
		return name;
	}

	public void setName(String name)
	{
		this.name = name;
	}

	public String getSex()
	{
		return sex;
	}

	public void setSex(String sex)
	{
		this.sex = sex;
	}

	public String getBirth()
	{
		return birth;
	}

	public void setBirth(String birth)
	{
		this.birth = birth;
	}

	public String getNationality()
	{
		return nationality;
	}

	public void setNationality(String nationality)
	{
		this.nationality = nationality;
	}

	public String getAddress()
	{
		return address;
	}

	public void setAddress(String address)
	{
		this.address = address;
	}

	public String getIssue()
	{
		return issue;
	}

	public void setIssue(String issue)
	{
		this.issue = issue;
	}

	public String getStart_date()
	{
		return start_date;
	}

	public void setStart_date(String start_date)
	{
		this.start_date = start_date;
	}

	public String getEnd_date()
	{
		return end_date;
	}

	public void setEnd_date(String end_date)
	{
		this.end_date = end_date;
	}

	public boolean isSuccess()
	{
		return success;
	}

	public void setSuccess(boolean success)
	{
		this.success = success;
	}

}
